// 封装vuex持久化存储模块
export const getUserInfo = () => {
  const defaultObj = { token: '', userId: '' }
  const obj = localStorage.getItem('shoppingUserInfo')
  return obj ? JSON.parse(obj) : defaultObj
}

export const setUserInfo = (obj) => {
  localStorage.setItem('shoppingUserInfo', JSON.stringify(obj))
}

export const getHistoryList = () => {
  const defaultArr = []
  const arr = localStorage.getItem('shoppingHistoryList')
  return arr ? JSON.parse(arr) : defaultArr
}

export const setHistoryList = (arr) => {
  localStorage.setItem('shoppingHistoryList', JSON.stringify(arr))
}
